package org.maodian.shindigbook.social.facebook.service;

import java.util.Set;
import java.util.concurrent.Future;

import org.apache.shindig.protocol.HandlerPreconditions;
import org.apache.shindig.protocol.Operation;
import org.apache.shindig.protocol.Service;
import org.apache.shindig.social.opensocial.service.SocialRequestItem;
import org.apache.shindig.social.opensocial.spi.CollectionOptions;
import org.apache.shindig.social.opensocial.spi.UserId;
import org.maodian.shindigbook.social.facebook.spi.AlbumService;

@Service(name = "shindigbook", path = "/{userId}/albums")
public class AlbumHandler {
  private AlbumService albumService;

  @Operation(httpMethods = "GET")
  public Future<?> get(SocialRequestItem request) {
    Set<UserId> users = request.getUsers();
    
    HandlerPreconditions.requireSingular(users, "only support a single user");
    
    return albumService.getAlbums(users, null, null, 
        request.getFields(), new CollectionOptions(request), request.getToken());
  }
}
